$(function () {
	//登录
	var url = "/data/login.php";
	$('button').click(function () {
	   var name = $('#name').val();
	   var password = $('#password').val();

	   $.ajax({
	   	  url:url,
          type:'post',
          data:{
              username: name,
              password:password
          },
          dataType:'json',
          success:function(data){
              //localStorage.setItem('mid',data.result.menber_id);
              if(data.errno == "0000"){
                  setTimeout(function(){
                    location.href = "index.html";
                  },1000);
              }else{
                  layer.msg(data.errmsg, {time:2000});
              } 
          },
          error:function(){
              layer.msg("网络错误请重试！");
          }
	   });
	});
});